package Hibernate;



import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

import Modelo.*;

public class HibernateUtil
{
    private static final SessionFactory sessionFactory;
    static
    {
        try
        {
        	 AnnotationConfiguration config = new AnnotationConfiguration();
        	 config.addAnnotatedClass(CasaCentral.class);
        	 config.addAnnotatedClass(Cliente.class);
        	 config.addAnnotatedClass(ComparativaPrecios.class);
        	 config.addAnnotatedClass(CondicionDePago.class);
        	 config.addAnnotatedClass(Cotizacion.class);
        	 config.addAnnotatedClass(Descuentos.class);
        	 config.addAnnotatedClass(Factura.class);
        	 config.addAnnotatedClass(General.class);
        	 config.addAnnotatedClass(HistorialGanancia.class);
        	 config.addAnnotatedClass(ItemCotizacion.class);
        	 config.addAnnotatedClass(ItemFactura.class);
        	 config.addAnnotatedClass(ItemHistorial.class);
        	 config.addAnnotatedClass(ItemListaPrecios.class);
        	 config.addAnnotatedClass(ItemOrdenCompra.class);
        	 config.addAnnotatedClass(ItemPedido.class);
        	 config.addAnnotatedClass(ItemRecargo.class);
        	 config.addAnnotatedClass(ListaDePrecios.class);
        	 config.addAnnotatedClass(Ofertas.class);
        	 config.addAnnotatedClass(OficinaDeVenta.class);
        	 config.addAnnotatedClass(OrdenCompra.class);
        	 config.addAnnotatedClass(Pedido.class);
        	 config.addAnnotatedClass(PoliticaBeneficio.class);
        	 config.addAnnotatedClass(PorFormaDePago.class);
        	 config.addAnnotatedClass(PorMonto.class);
        	 config.addAnnotatedClass(PorPagoContado.class);
        	 config.addAnnotatedClass(PorVolumen.class);
        	 config.addAnnotatedClass(Proveedor.class);
        	 config.addAnnotatedClass(Remito.class);
        	 config.addAnnotatedClass(Rodamiento.class);
        	 config.addAnnotatedClass(Stock.class);
        	 config.addAnnotatedClass(SolicitudCotizacion.class);
        	 config.addAnnotatedClass(ItemSolicitudCotizacion.class);

             sessionFactory = config.buildSessionFactory();
        }
        catch (Throwable ex)
        {
            System.err.println("Initial SessionFactory creation failed." + ex);
            throw new ExceptionInInitializerError(ex);
        }
    }
  
    public static SessionFactory getSessionFactory()
    {
        return sessionFactory;
    }
}
